//
// Created by Administrator on 2019/6/6 0006.
//

#ifndef RTMPDEMO_AUDIOCHANNEL_H
#define RTMPDEMO_AUDIOCHANNEL_H


#include <faac.h>
#include <jni.h>
#include <pty.h>
#include "librtmp/rtmp.h"


class AudioChannel {

    typedef void (*AudioCallback)(RTMPPacket *packet);

public:
    void encodeData(int8_t *data);
    void setAudioEncInfo(int sampleInHz, int channels);
    jint getInputSamples();
    RTMPPacket* getAudioTag();
    ~AudioChannel();

    void setAudioCallback(AudioCallback audioCallback);

private:
    int mChannels;
    faacEncHandle audioCodec;
    u_long inputSamples;
    u_long maxOutputBytes;
    u_char *buffer = 0;
    AudioCallback audioCallback;
};


#endif //RTMPDEMO_AUDIOCHANNEL_H
